<template>
  <div id="notice">
    <div class="header">
      <Header :name="name"></Header>
    </div>
    <div class="content">
      <p>推送通知</p>
      <div v-for="item in data" :key="item.id">
        <div class="item">
          <span>{{ item.name }}</span>
          <van-switch
            v-model="item.flag"
            active-color="#f6bb18"
            inactive-color="#dcdee0"
          />
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { reactive } from "vue";
import Header from "./Header.vue";
import { useRoute } from "vue-router";

const route = useRoute();
const name = route.query.name;
console.log(name);

const data = reactive([
  { id: 1, name: "通知", flag: true },
  { id: 2, name: "声音", flag: false },
  { id: 3, name: "颤动", flag: false },
  { id: 4, name: "特别优惠", flag: false },
  { id: 5, name: "付款方式", flag: false },
  { id: 6, name: "返现", flag: false },
  { id: 7, name: "应用程序更新", flag: false },
]);
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
}

#notice {
  width: 100vw;
  height: 100vh;
}

.content {
  width: 80%;
  margin-left: 10%;
  margin-top: 2rem;
}

.content p {
  font-size: 0.9rem;
}

.item {
  width: 100%;
  height: 4rem;
  line-height: 4rem;
  display: flex;
  justify-content: space-between;
}

.van-switch {
  margin-top: 1rem;
}
</style>